package cn.training.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import cn.training.bean.UserBean;
import cn.training.service.HelloWorldService;

@Controller("HelloWorldController")
@RequestMapping("/")
public class HelloWorldController {
	
	@Autowired
	HelloWorldService helloWorldService;
	
	

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String index(Model model) {
        return "helloWorld";
    }
    @RequestMapping(value = "/init", method = RequestMethod.POST)
    public String initLogin(UserBean userBean,Model model) {
    	
    	UserBean result=helloWorldService.searchUser(userBean);
    	model.addAttribute("userBean",result);
        return "login";
    }
}
